﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BarCodeGenerator
{
    public partial class CodeBarCodeFrm : Form
    {
        public CodeBarCodeFrm()
        {
            InitializeComponent();
        }
        /// <summary>
        ///  生 成 Code39 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            pictureBox1.Image = new CSharpCode39()
            {
                DataToEncode = this.textBox1.Text,
                HumanReadable = true,
                Checksum = true,
                IsDisplayCheckCode = true
                //,IsDisplayStartStopSign=true
                //,CodeBarColor=Color.Red
            }.getBitmapImage(96);
        }
        /// <summary>
        /// 鼠标双击条码图片触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            pictureBox1.Image.Save(Guid.NewGuid().ToString() + ".png");
            MessageBox.Show("保存图片成功！");
        }
    }
}
